package com.chen.recruit.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 性别枚举
 *
 * @author cgy
 * @date 2022/9/26
 */
@Getter
@AllArgsConstructor
public enum SexEnum implements BaseEnum {

    MALE("男", 1),
    FEMALE("女", 0);

    @JsonValue
    private String label;

    @EnumValue
    private int value;

    @Override
    public String getLabel() {
        return label;
    }

    public static SexEnum getByLabel(String label) {
        SexEnum[] arr = SexEnum.values();
        for (SexEnum sexEnum : arr) {
            if (sexEnum.label.equals(label)) {
                return sexEnum;
            }
        }
        return null;
    }

}
